* Risk premia

/*
*Run this block if stand alone. If commented out, it is because this will be run from _ricardo_master.do
set more off, perm
clear
graph drop _all
local dir "/Users/rreis/Dropbox/05Shared_folders/HRR/HRR_InflDisaster/Ricardo"  // RR's directory
*local dir "C:\Users\marin\Dropbox\HRR_InflDisaster\Ricardo"  // Marina's directory
cd `dir'
local region = "EZ" 	// set region US or EZ, so must run program twice
*/

local region `1' 	 // set region US or EZ, so must run program twice

///////////////////////////////// Graph style //////////////////////////////////
    //  ssc install grstyle
    set scheme s2color
    grstyle init

    grstyle color background white
    // gridlines
    grstyle color major_grid dimgray
    grstyle linewidth major_grid thin
    grstyle yesno draw_major_hgrid yes
    grstyle yesno grid_draw_min yes
    grstyle yesno grid_draw_max yes
    grstyle anglestyle vertical_tick horizontal grstyle color ci_area gs12%50
    // legend
    grstyle clockdir legend_position 6
    grstyle numstyle legend_cols 2
    grstyle linestyle legend none
////////////////////////////////////////////////////////////////////////////////

clear
u "$input/`region'_allm"

*Risk premia
g rph_10y_pool_c = (p4_10y_pool_c - tail4_10y) / (tail5_10y-tail4_10y)
g rpl_10y_pool_c = - (p0_10y_pool_c - tail0_10y) / (tailm1_10y-tail0_10y)
g rph_10y_high_c = (p4_10y_high_c - tail4_10y) / (tail5_10y-tail4_10y)
g rpl_10y_low_c = - (p0_10y_low_c - tail0_10y) / (tailm1_10y-tail0_10y)

tsset date_ym
graph twoway tsline rph_10y_pool_c rph_10y_high_c rpl_10y_low_c, ///
lp(dash solid solid) lw(thick thick thick) ytitle("%") xtitle("Month") ylabel(-0.30(0.10)0.70) tlabel(2010m1(24)2024m5) ///
legend(label(1 "Pooled estimate") label(2 "High inflation") label(3 "Low inflation") position(6) ring(0)) ///
name(RiskPremia)
graph export "$figures/fig_`region'_riskpremia.pdf", replace
